package com.bblei.designpatterndemo.strategypattern.duck;

import com.bblei.designpatterndemo.strategypattern.flybehavior.FlyBehavior;
import com.bblei.designpatterndemo.strategypattern.quackbehavior.QuackBehavior;


public abstract class Duck {

	FlyBehavior mFlyBehavior;
	QuackBehavior mQuackBehavior;

	public Duck() {

	}

    /**
     * 策略方法
     */
	public void Fly() {
		mFlyBehavior.fly();
	}

    /**
     * 策略方法
     */
	public void Quack() {
		mQuackBehavior.quack();
	}

    /**
     * 子类需要覆盖重写的方法
     */
	public abstract void display();

	public void SetQuackBehavoir(QuackBehavior qb) {
		mQuackBehavior = qb;
	}

	public void SetFlyBehavoir(FlyBehavior fb) {
		mFlyBehavior = fb;
	}

    /**
     * 公共的方法
     */
	public void swim() {
		System.out.println("~~im swim~~");
	}
}
